package cn.edu.zxj.springblog.mapper;

import cn.edu.zxj.springblog.model.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * Created with IntelliJ IDEA.
 * Description：针对 user 相关的数据库操作
 *
 * @author: zxj
 * @date: 2024-02-04
 * @time: 18:15:44
 */
@Mapper
public interface UserInfoMapper {

    /**
     * @description: 依据用户名查询用户信息
     **/
    @Select("select id, user_name, password, github_url, delete_flag, create_time, update_time" +
            " from user where delete_flag = 0 and  user_name = #{name}")
    UserInfo selectByName(String name);

    /**
     * @description: 已经 ID 查询用户信息
     **/
    @Select("select id, user_name, password, github_url, delete_flag, create_time, update_time" +
            " from user where delete_flag = 0 and  id = #{id}")
    UserInfo selectById(Integer id);

}
